<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/config/c.tld" prefix="c"%>
<%@ taglib prefix="fn" uri="/WEB-INF/config/fn.tld"%>
<%@ taglib prefix="fmt" uri="/WEB-INF/config/fmt.tld"%>

<!DOCTYPE HTML>
<html>
  <head>
    <title>轮播图管理</title>
  </head>
  <body>
		<ul class="breadcrumb">
			<li>
				<a href="index.html">首页</a>
				<i class="icon-angle-right"></i>
			</li>
			<li>
				<a href="#">轮播图管理</a>
				<i class="icon-angle-right"></i>
			</li>
			<li>
				<a href="#">更新信息</a>
			</li>
		</ul>
		<div class="row-fluid ">
			<div class="box span12">
				<div class="box-header" data-original-title>
					<h2><i class="halflings-icon white edit"></i><span class="break"></span>请填写"轮播图"的信息</h2>
					<div class="box-icon">
						<a href="#" class="btn-minimize"><i class="halflings-icon white chevron-up"></i></a>
					</div>
				</div>
				<div class="box-content">
					<form class="form-horizontal" action="bannertwo/manage/save.html" method="post" enctype="multipart/form-data">
						<input type="hidden" name="id" value="${banner.id }">
						<fieldset>
							<div class="control-group hidden-phone">
								<div class="span12">
									<label class="control-label">图片</label>
									<div class="controls">
										<input class="input-file uniform_on" id="fileInput" name="fileInput" type="file">
										<span>图片尺寸[960*600]</span>
										<img src="${banner.image}" id="imageLeft" style="width:200px;">
									</div>
								</div>
							</div>
							<div style="margin-left: 10%">
								图片url:<input type="text" name="url" value="${banner.url}">
							</div>
							<div class="form-actions">
								<button type="submit" class="btn btn-primary">保存信息</button>
							</div>
						</fieldset>
					</form>
				</div>
			</div><!--/span-->
		</div><!--/row-->
		<script>
		$("#fileInput").change(function () {
			var objUrl = getObjectURL(this.files[0]);
			console.log("objUrl = " + objUrl);
			if (objUrl) {
				$("#imageLeft").attr("src", objUrl);
			}
		});
		//建立一个可存取到该file的url
		function getObjectURL(file) {
			var url = null;
			if (window.createObjectURL != undefined) { // basic
				url = window.createObjectURL(file);
			} else if (window.URL != undefined) { // mozilla(firefox)
				url = window.URL.createObjectURL(file);
			} else if (window.webkitURL != undefined) { // webkit or chrome
				url = window.webkitURL.createObjectURL(file);
			}
	
			return url;
		}
	</script>
  </body>
</html>
